package com.scott.spring.ch09.service;

import org.springframework.beans.factory.DisposableBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author 黄后林
 * @version 1.0
 * @date 2021-12-14 13:46:47
 */
public class RoleService implements DisposableBean {
    public RoleService() {
        System.out.println("--------执行ch09#RoleService--------");
    }

    public int add(int x,int y){
        System.out.println("--------执行ch09#add--------");
        int sum =x+y;
        return sum;
    }

    // 2、容器关闭前执行
    @Override
    public void destroy() throws Exception {
        System.out.println("--------执行ch09#destroy--------");
    }
}
